// index.js
// 获取应用实例
const mainPage = require("../../models/index")

Page({
  data: {
    value:"",
    long : 15,
  },
  async onLoad() {
    var data = await mainPage(this.data.long);
    console.log(data.data.playlists);
    this.setData({
      value:data.data.playlists,
    })
  },
  async onReachBottom(){
    let long = this.data.long+15;
    this.setData({
      long,
    })
    let value = this.data.value;
    var data = await mainPage(this.data.long);
    value.push(...data.data.playlists)
    this.setData({
      value,
    })
    // console.log(this.data.value);
  },
  onGoto(event){
    console.log(event.currentTarget.dataset.id);
    let id = event.currentTarget.dataset.id;
    wx.navigateTo({
      url: `../detail/detail?id=${id}`,
    })
  }
})
